#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@File ：RoleModel.py
@Author ：zqy
@Email : zqingy@work@163.com
@note:
"""

from sqlalchemy import String, Integer, Column
from sqlalchemy.orm import relationship

from application.util.MysqlUtil import mysql_db


class RoleModel(mysql_db.Model):
    __tablename__: str = "role"
    # 主键
    id = Column(Integer, primary_key=True, unique=True, autoincrement=True, comment="主键，自增")
    # 角色名称
    name = Column(String(16), nullable=True, comment="角色名称，长度为16")
    # 角色描述
    description = Column(String(32), nullable=True, comment="角色描述，长度为32")

    users = relationship("UserRoleModel", back_populates="role", cascade="all, delete-orphan")
